<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex order_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between order_fd0_0'>
					<view class='flex flex-wrap align-center order_fd0_0_c0'>
					</view>
					<text class='order_fd0_0_c1'>订单管理</text>
					<view class='flex align-center justify-end order_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex order_flex_1"
				:style="{top:(88+StatusBarRpx)+'rpx', }">
				<view class='flex flex-wrap align-center order_fd1_0'>
					<image class='order_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"33.png"'></image>
					<benben-input class='flex-sub order_fd1_0_c1' type="text" :placeholder="`请输入订单号`"
						confirm-type="done" :maxlength="20"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:24rpx" v-model="keyword"
						@confirm="getOrderFunc()" />
					<text @tap.stop="getOrderFunc()">搜索</text>
				</view>
				<view>
					<benben-flex-tabs class-name='order_benbenTabsfd1_1' v-model="tabs" ref="benben_tabsfd1_1"
						select-mark="benben_tabsfd1_1" key="benben_tabsfd1_1" :open-title-type='false'
						:open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_1" @change="getOrderFunc()">

						<scroll-view @scroll="tabsInfofd1_1.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_1"
							class="benben-tabs" style="width:750rpx" :scroll-x="true"
							:scroll-left.sync="tabsInfofd1_1.moveX" scroll-with-animation="all .3s ease">
							<view class="benben-tabs-content" id="benben_tabsfd1_1-content">
								<view id="benben_tabsfd1_1-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_1': tabs == '1', 'flex flex-wrap align-center': true }"
										@tap="tabs = '1'" :id="`benben_tabsfd1_1-title-item-${'1'}`">
										<text>全部</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_1': tabs == '10', 'flex flex-wrap align-center order_titlefd1_0_c3': true }"
										@tap="tabs = '10'" :id="`benben_tabsfd1_1-title-item-${'10'}`">
										<text>待接单</text>
										<benben-message-num class='order_titleItemfd1_0_c3_c1'
											:message-num="orderNewData.treat_orders" size='20' color='#fff'
											background-color='red'>
										</benben-message-num>
									</view>
									<view
										:class="{ 'checkTitlefd1_1': tabs == '15', 'flex flex-wrap align-center order_titlefd1_0_c3': true }"
										@tap="tabs = '15'" :id="`benben_tabsfd1_1-title-item-${'15'}`">
										<text>待服务</text>
										<benben-message-num class='order_titleItemfd1_0_c3_c1'
											:message-num="orderNewData.treat_serve" size='20' color='#fff'
											background-color='red'>
										</benben-message-num>
									</view>
									<view
										:class="{ 'checkTitlefd1_1': tabs == '30', 'flex flex-wrap align-center order_titlefd1_0_c3': true }"
										@tap="tabs = '30'" :id="`benben_tabsfd1_1-title-item-${'30'}`">
										<text>服务中</text>
										<benben-message-num class='order_titleItemfd1_0_c3_c1'
											:message-num="orderNewData.inservice" size='20' color='#fff'
											background-color='red'>
										</benben-message-num>
									</view>
									<view
										:class="{ 'checkTitlefd1_1': tabs == '45', 'flex flex-wrap align-center': true }"
										@tap="tabs = '45'" :id="`benben_tabsfd1_1-title-item-${'45'}`">
										<text>已完成</text>
									</view>
								</view>
								<view :style="{ left: tabsInfofd1_1.lineleft, maxWidth: tabsInfofd1_1.lineWidth ,}"
									id="benben_tabsfd1_1-line"
									class="benben-tabs-line flex benben-flex-tabs-line order_linefd1_1"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view>

			</view>
			<view :style="{height: '171rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout order_flex_2">
				<template v-for='(item,key0) in orderList'>
					<view class='flex flex-direction flex-wrap align-stretch order_fd2_0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/order/orderDetails/orderDetails?aid=${item.aid}`"
						:key='key0'>
						<view class='flex flex-wrap align-center order_fd2_0_c0'>
							<text class='flex-sub order_fd2_0_c0_c0'>{{item.service_title}}</text>
							<text class='order_fd2_0_c0_c1'>{{item.order_status_name}}</text>
							<text class='order_fd2_1_c0_c20089' v-if="item.service_type == '1'">一口价</text>
							<text class='order_fd2_1_c0_c20089' v-if="item.service_type == '2'">议价</text>
							<text class='order_fd2_1_c0_c20089' v-if="item.service_type == '3'">竞价</text>
						</view>
						<view class='flex flex-wrap align-center order_fd2_0_c1'>
							<text class='order_fd2_0_c1_c0'>订单编号</text>
							<text class='flex-sub order_fd2_0_c1_c1'>{{item.order_sn}}</text>
						</view>
						<view class='flex flex-wrap align-center order_fd2_0_c1'>
							<text class='order_fd2_0_c1_c0'>预约时间</text>
							<text class='flex-sub order_fd2_0_c1_c1'>{{item.door_time}}</text>
						</view>
						<view class='flex flex-wrap align-center order_fd2_0_c1'>
							<text class='order_fd2_0_c1_c0'>服务地址</text>
							<text class='flex-sub order_fd2_0_c1_c1'>{{item.address}}</text>
						</view>
						<!-- <view class='flex flex-wrap align-center order_fd2_0_c1'>
							<text class='order_fd2_0_c1_c0'>已付金额</text>
							<text class='order_fd2_0_c1_c1'>￥</text>
							<text class='order_fd2_0_c1_c1'>{{item.deposit_amount}}</text>
						</view> -->
						<view class='flex flex-wrap align-center justify-between order_fd2_0_c5'>
							<view class='flex flex-wrap align-center order_fd2_0_c5_c0'
								@tap.stop="callMobile(item.user_mobile)">
								<image class='order_fd2_0_c5_c0_c0' mode="aspectFit" :src='STATIC_URL+"78.png"'></image>
								<text class='order_fd2_0_c5_c0_c1'>联系雇主</text>
							</view>
							<view class='flex flex-wrap align-center order_fd2_0_c5_c0'
								@tap.stop="navigationsFunc(item)">
								<image class='order_fd2_0_c5_c0_c0' mode="aspectFit" :src='STATIC_URL+"79.png"'></image>
								<text class='order_fd2_0_c5_c0_c1'>地址导航</text>
							</view>
						</view>
						<view class='flex flex-wrap align-center justify-end order_fd2_0_c6'>
							<button class='order_fd2_0_c6_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
								:data-url="`/pages/order/orderDetails/orderDetails?aid=${item.aid}`"
								v-if=" item.order_status<'45'">查看详情</button><button class='order_fd2_0_c6_c0'
								@tap.stop="assignmentDeleteFunc(item.aid)" v-if=" item.order_status=='45'">删除订单</button>
							<button class='order_fd2_0_c6_c1' @tap.stop="handleJumpDiy" data-type="navigateTo"
								:data-url="`/pages/index/selectMaster/selectMaster?order_sn=${item.aid}`"
								v-if=" item.order_status=='10'">指派师傅</button><button class='order_fd2_0_c6_c1'
								@tap.stop="handleJumpDiy" data-type="navigateTo"
								:data-url="`/pages/order/userEvaluation/userEvaluation?id=${item.aid}`"
								v-if=" item.order_status=='45'">查看评价</button>
						</view>
					</view>
				</template>
				<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
					:listDataLength="listDataLength" :isLoadInit="isLoadInit" v-if="isLogin == true"></fu-empty>
			</view>

			<!---flex布局flex布局结束-->
			<view class='flex flex-direction flex-wrap align-center self-center justify-center' v-if=" isLogin===false">
				<benben-empty>
					<view class='flex flex-direction flex-wrap align-center order_fd2_1_c0'>
						<image class='order_fd2_1_c0_c0' mode="widthFix" src='/static/empty/order.png'></image>

					</view>
				</benben-empty>
				<button class='order_fd2_1_c1' @tap.stop="handleJumpDiy" data-type="navigateTo"
					:data-url="`/pages/tabBar/logon/logon`">您还没有登录，去登录</button>
			</view>
			<benben-popup v-model="popupShow1694425648944" :mask="true" :mask-close-able="true" mode='center'>
				<!---退出登录flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center orderDetails_flex_13"
					@tap.stop="popupShow1650940432200=true">
					<text class='orderDetails_fd13_0'>提示</text>
					<text class='orderDetails_fd13_1'>确定要删除该订单吗？</text>
					<view class='flex flex-wrap align-center orderDetails_fd13_2'>
						<button class='orderDetails_fd13_2_c0' @tap.stop="popupShow1694425648944=false">取消</button>
						<button class='orderDetails_fd13_2_c1' @tap.stop="postDeleteFunc()">确定</button>
					</view>
				</view>
				<!---退出登录flex布局结束-->
			</benben-popup>

		</view>
	</view>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"popupShow1694425648944": false,
				"newData": {
					"order_num": "",
					"sys_num": "",
					"no_read_num": "",
					"new_order_message": "",
					"new_sys": "",
					"order_time": "",
					"sys_time": ""
				},
				"orderNewData": {
					"complete": "",
					"inservice": "",
					"treat_evaluate": "",
					"treat_orders": "",
					"treat_serve": "",
				},
				"tabsInfofd1_1": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0
				},
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"tabs": "1",
				"keyword": "",
				"detele_id": "",
				"orderList": [],
				"shopID": uni.getStorageSync('shopID') || ''
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			isLogin() {
				return this.$store.state.token == '' ? false : true;
			},
			/**
			 * @returns 
			 * Android       安卓
			 * IOS       苹果
			 * Web       H5 或 pc
			 * Wechat       微信小程序
			 * Alipay       支付宝小程序
			 * Baidu       百度小程序
			 * ByteBounce       抖音小程序
			 * 360       360小程序
			 * FastApp       快应用
			 */
			appSystemIdentification() {
				return this.$store.state.appSystemIdentification
			}
		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.shopID = uni.getStorageSync('shopID') || ''
			this.getOrderFunc()
			this.getNewDataFunc()
			this.getOrderNewFunc()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getOrderFunc()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取订单列表信息
			getOrderFunc() {
				if (this.isLogin == true) {
					this.minixPagingListsApi = global.apiUrls.post646c8b415ffca;
					this.pageingListApiMethod = 'get';
					this.allowOnloadGetList = false;
					this.pagingListPostDataContent = {
						order_status: this.tabs,
						// usermerchant_id: this.shopID,
						keyword: this.keyword
					}
					this.listData = [];
					this.orderList = this.listData;
					this.pagingListToggle();
				}
			},
			//获取全部消息
			async getNewDataFunc() {
				//请求方法
				//数据验证
				if (this.isLogin == true) {
					let datanewData = await this.$api.get(global.apiUrls.post64140908ca17c, {

					});

					if (datanewData.data.code != 1) {
						this.$message.info(datanewData.data.msg);
						return
					}
					let infonewData = datanewData.data;
					this.newData = infonewData.data
					uni.setTabBarBadge({
						index: 2,
						text: this.newData.no_read_num
					})
				}
			},
			//获取订单消息角标
			async getOrderNewFunc() {
				if (this.isLogin === true) {
					//请求方法
					//数据验证
					let dataorderNewData = await this.$api.get(global.apiUrls.post6586734285f8d, {

					});
					if (dataorderNewData.data.code != 1) {
						this.$message.info(dataorderNewData.data.msg);
						return
					}
					let infoorderNewData = dataorderNewData.data;
					this.orderNewData = infoorderNewData.data
				}
			},
			//删除赋值
			assignmentDeleteFunc(deleteID) {
				this.detele_id = deleteID;
				this.popupShow1694425648944 = true;
			},
			//提交订单删除
			async postDeleteFunc() {
				//请求方法
				//数据验证

				let data63a03271a4758 = await this.$api.dbPost(global.apiUrls.post63a03271a4758, {
					aid: this.detele_id
				});
				if (!data63a03271a4758) return
				if (data63a03271a4758.data.code != 1) {
					this.$message.info(data63a03271a4758.data.msg);
					return
				}
				this.popupShow1694425648944 = false;
				this.getOrderFunc()
			},
			//导航
			navigationsFunc(e) {
				if (!this.setCheckPermission(8)) {
					return
				}
				uni.openLocation({
					latitude: Number(e.lat), //目标纬度
					longitude: Number(e.lng), //目标经度
					address: e.address, //地址
					scale: 18
				});
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.order_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.order_fd0_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.order_fd0_0_c0 {
		width: 200rpx;
		height: 88rpx;
	}

	.order_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.order_flex_1 {
		background: #fff;
		width: 750rpx;
		height: 171rpx;
		overflow: hidden;
		z-index: 10;
		top: 88rpx;
		background-size: 100% auto !important;
	}

	.order_linefd1_1 {
		background: rgba(227, 29, 26, 1);
		width: 50rpx;
		height: 8rpx;
		top: 80rpx;
		background-size: 100% auto !important;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}

	.checkTitlefd1_1 {
		font-weight: 700 !important;
		font-size: 32rpx !important;
		color: rgba(227, 29, 26, 1) !important;
		background-color: rgba(255, 255, 255, 0) !important;
	}

	::v-deep .order_benbenTabsfd1_1 {
		background: #fff;
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		text-align: center;
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
	}

	.order_fd1_0_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #333;
	}

	.order_fd1_0_c0 {
		width: 32rpx;
		height: 32rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.order_fd1_0 {
		background: #F9F9F9;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		width: 702rpx;
		height: 64rpx;
		margin: 12rpx 24rpx 0rpx 24rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.order_flex_2 {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.order_fd2_0_c6_c1 {
		background: #E31D1A;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		font-size: 24rpx;
		color: #fff;
		width: 160rpx;
		height: 56rpx;
		line-height: 56rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 30rpx;
	}

	.order_fd2_0_c6_c0 {
		background: #F8F8F8;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		font-size: 24rpx;
		color: #333;
		width: 160rpx;
		height: 56rpx;
		line-height: 56rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 30rpx;
	}

	.order_fd2_0_c6 {
		border-top: 1px solid #eee;
		padding: 24rpx 0rpx 32rpx 0rpx;
	}

	.order_fd2_0_c5_c0_c1 {
		color: #E60036;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 36rpx;
	}

	.order_fd2_0_c5_c0_c0 {
		width: 28rpx;
		height: 34rpx;
		margin: 0rpx 20rpx 0rpx 0rpx;
	}

	.order_fd2_0_c5_c0 {
		background: rgba(250, 209, 209, 1);
		padding: 20rpx 70rpx 20rpx 70rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.order_fd2_0_c5 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.order_fd2_0_c1_c1 {
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.order_fd2_0_c1_c0 {
		margin: 0rpx 24rpx 0rpx 0rpx;
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.order_fd2_0_c1 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.order_fd2_0_c0_c1 {
		color: #333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 40rpx;
	}

	.order_fd2_0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		margin: 0rpx 24rpx 0rpx 0rpx;
		line-height: 45rpx;
	}

	.order_fd2_0_c0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.order_fd2_0 {
		background: #fff;
		background-size: 100% auto !important;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	//删除弹窗
	.orderDetails_flex_13 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.orderDetails_fd13_0 {
		font-size: 36rpx;
		font-weight: 800;
		line-height: 44rpx;
		color: #333333;
		margin: 40rpx 0rpx 40rpx 0rpx;
	}

	.orderDetails_fd13_1 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}

	.orderDetails_fd13_2_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: #E31D1A;
		width: 264rpx;
	}

	.orderDetails_fd13_2_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 103rpx 0rpx 103rpx;
	}

	.orderDetails_fd13_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}

	.order_fd2_1_c0_c0 {
		width: 400rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.order_fd2_1_c0 {
		width: 100%;
		padding: 50rpx 0rpx 50rpx 0rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.order_fd2_1_c1 {
		background: #e31d1a;
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		width: 500rpx;
		line-height: 70rpx;
		font-size: 28rpx;
		color: #fff;
		margin-top: 40rpx;
	}

	.order_fd2_1_c0_c20089 {
		border: 1px solid #E31D1A;
		color: #E31D1A;
		font-size: 24rpx;
		font-weight: 700;
		line-height: 36rpx;
		padding: 0rpx 8rpx 0rpx 8rpx;
		border-radius: 8rpx;
		height: 36rpx;
		margin-left: 12rpx;
	}

	//角标
	.order_titlefd1_0_c3 {
		position: relative;
	}

	.order_titleItemfd1_0_c3_c1 {
		position: absolute;
		right: -30rpx;
		top: -10rpx;
	}
</style>